#!/bin/bash
set -e
sudo apt-get update
sudo apt-get -y install \
   build-essential cmake lcov \
   zlib1g-dev libjpeg-dev libgnutls28-dev libssl-dev
cmake -S . -B build \
    -DCI_MODE=ON -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Debug \
    -DREQUIRE_CRYPTO_OPENSSL=1 -DREQUIRE_CRYPTO_GNUTLS=1 \
    -DENABLE_QTC=1 -DENABLE_COVERAGE=ON
cmake --build build --verbose -j$(nproc) -- -k
(cd build; ctest --verbose)
lcov --capture --directory . --output-file coverage.info
lcov --remove coverage.info '/usr/*' --output-file coverage.info
lcov --list coverage.info
